<html>
<head><meta charset="utf-8"><title>The ? Operator · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/The.20.3F.20Operator.html">The ? Operator</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212308040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/The%20%3F%20Operator/near/212308040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> avi <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/The.20.3F.20Operator.html#212308040">(Oct 05 2020 at 14:39)</a>:</h4>
<p>In terms of implementation, what exactly is the ‘?’ operator? Does it get expanded to the match error and return statement? If I want to learn more, where/how should I start? Appreciate any leads, thank you! 😃</p>
<p>PS: total newb here.</p>



<a name="212308282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/The%20%3F%20Operator/near/212308282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/The.20.3F.20Operator.html#212308282">(Oct 05 2020 at 14:41)</a>:</h4>
<p><a href="https://doc.rust-lang.org/std/ops/trait.Try.html">https://doc.rust-lang.org/std/ops/trait.Try.html</a></p>



<a name="212308395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/The%20%3F%20Operator/near/212308395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/The.20.3F.20Operator.html#212308395">(Oct 05 2020 at 14:42)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/d890e64dff3fd2c28635c60cc9315648dd46c8f7/compiler/rustc_ast_lowering/src/expr.rs#L1476">https://github.com/rust-lang/rust/blob/d890e64dff3fd2c28635c60cc9315648dd46c8f7/compiler/rustc_ast_lowering/src/expr.rs#L1476</a> is the code that does the desugaring</p>



<a name="212310546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/The%20%3F%20Operator/near/212310546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> avi <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/The.20.3F.20Operator.html#212310546">(Oct 05 2020 at 14:54)</a>:</h4>
<p>Thank you!!</p>



<a name="212327215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/The%20%3F%20Operator/near/212327215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/The.20.3F.20Operator.html#212327215">(Oct 05 2020 at 16:56)</a>:</h4>
<p>You can also read about it in the "Detailed Design" section (today would be "Reference-level explanation") of the RFC: <a href="https://github.com/rust-lang/rfcs/blob/master/text/1859-try-trait.md#desugaring-and-the-try-trait">https://github.com/rust-lang/rfcs/blob/master/text/1859-try-trait.md#desugaring-and-the-try-trait</a></p>
<p>What are you hoping to do with the knowledge?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>